#delimit ;
*REStat paper, "Breastfeeding and Children's Early Cognitive Outcomes;
log using x:/Donnanew/psid08.log, replace;
clear;
set mem 40m;
set more off;
set matsize 800;

use x:/Donnanew/pch082;
gen wt97 = ch97prwt*100;
gen wt02 = ch02prwt*100;

gen wt97x = int(wt97);
gen wt02x = int(wt02);

gen wtx = wt97x if year56 == 1997;
replace wtx = wt02x if year56 == 2002;



sum [fweight=wtx];
sum if bfeed==0 [fweight=wtx];
sum if bfeed==1 [fweight=wtx];
sum if bf1==1 [fweight=wtx];
sum if bf23==1 [fweight=wtx];
sum if bf45==1 [fweight=wtx];
sum if bf6p==1 [fweight=wtx];

**missing obs., dvs;
replace regnc = 0 if regdv == 1;
replace regs = 0 if regdv == 1;
replace regw = 0 if regdv == 1;

replace momhgc = 0 if momhgcdv == 1;
replace dadhgc = 0 if dadhgcdv == 1;
replace mompcraw = 0 if mompcdv == 1;

replace marbirth = 0 if mardv == 1;
replace cath = 0 if reldv == 1;
replace bapt = 0 if reldv == 1;

replace wic97 = 0 if wicdv == 1;

replace warm97 = 0 if warmdv == 1;

replace fborn = 0 if borddv == 1;
replace sborn = 0 if borddv == 1;


**just curious, what happen if throw out outliers;
**replace ap56 = . if ap56 > 2.5;
**replace ap56 = . if ap56 < -2.5;

**replace lw56 = . if lw56 > 2.5;
**replace lw56 = . if lw56 < -2.5;

**summarize ap56 lw56;

**'plain' specification;			
reg ap56 bfeed femch black hisp newimmi bapt cath momhgc dadhgc ageb regnc regs regw 
               wic97 marbirth
			   fborn sborn glt35 g3537 le55lb
			   regdv momhgcdv dadhgcdv mardv reldv wicdv borddv
				 [pweight=wtx], robust cluster(pcg97id); 				 			
		
reg lw56 bfeed femch black hisp newimmi bapt cath momhgc dadhgc ageb regnc regs regw 
               wic97 marbirth
			   fborn sborn glt35 g3537 le55lb
			   regdv momhgcdv dadhgcdv mardv reldv wicdv borddv
				 [pweight=wtx], robust cluster(pcg97id); 		
				 
**add in mother's test score;
reg ap56 bfeed femch black hisp newimmi bapt cath momhgc dadhgc ageb regnc regs regw 
               wic97 marbirth
			   fborn sborn glt35 g3537 le55lb
			   regdv momhgcdv dadhgcdv mardv reldv wicdv borddv
			   mompcraw mompcdv
				 [pweight=wtx], robust cluster(pcg97id); 
				 
reg lw56 bfeed femch black hisp newimmi bapt cath momhgc dadhgc ageb regnc regs regw 
               wic97 marbirth
			   fborn sborn glt35 g3537 le55lb
			   regdv momhgcdv dadhgcdv mardv reldv wicdv borddv
			   mompcraw mompcdv
				 [pweight=wtx], robust cluster(pcg97id); 
				 	
**add in home score and household income;	
reg ap56 bfeed femch black hisp newimmi bapt cath momhgc dadhgc ageb regnc regs regw 
               wic97 marbirth
			   fborn sborn glt35 g3537 le55lb
			   regdv momhgcdv dadhgcdv mardv reldv wicdv borddv
			   mompcraw mompcdv home97 lninc97
				 [pweight=wtx], robust cluster(pcg97id); 
				 
reg lw56 bfeed femch black hisp newimmi bapt cath momhgc dadhgc ageb regnc regs regw 
               wic97 marbirth
			   fborn sborn glt35 g3537 le55lb
			   regdv momhgcdv dadhgcdv mardv reldv wicdv borddv
			   mompcraw mompcdv home97 lninc97
				 [pweight=wtx], robust cluster(pcg97id); 		
		
**now do separate dummy variables;		
**'plain' specification;
reg ap56 bf1 bf23 bf45 bf6p
  femch black hisp newimmi bapt cath momhgc dadhgc ageb regnc regs regw 
               wic97 marbirth
			   fborn sborn glt35 g3537 le55lb
			   regdv momhgcdv dadhgcdv mardv reldv wicdv borddv
				 [pweight=wtx], robust cluster(pcg97id); 
		
reg lw56 bf1 bf23 bf45 bf6p
  femch black hisp newimmi bapt cath momhgc dadhgc ageb regnc regs regw 
               wic97 marbirth
			   fborn sborn glt35 g3537 le55lb
			   regdv momhgcdv dadhgcdv mardv reldv wicdv borddv
				 [pweight=wtx], robust cluster(pcg97id); 		

**add in mother's test score;
reg ap56 bf1 bf23 bf45 bf6p
 femch black hisp newimmi bapt cath momhgc dadhgc ageb regnc regs regw 
               wic97 marbirth
			   fborn sborn glt35 g3537 le55lb
			   regdv momhgcdv dadhgcdv mardv reldv wicdv borddv
			   mompcraw mompcdv
				 [pweight=wtx], robust cluster(pcg97id); 
				 
reg lw56 bf1 bf23 bf45 bf6p
 femch black hisp newimmi bapt cath momhgc dadhgc ageb regnc regs regw 
               wic97 marbirth
			   fborn sborn glt35 g3537 le55lb
			   regdv momhgcdv dadhgcdv mardv reldv wicdv borddv
			   mompcraw mompcdv
				 [pweight=wtx], robust cluster(pcg97id); 
				 	
**add in home score and household income;	
reg ap56 bf1 bf23 bf45 bf6p
 femch black hisp newimmi bapt cath momhgc dadhgc ageb regnc regs regw 
               wic97 marbirth
			   fborn sborn glt35 g3537 le55lb
			   regdv momhgcdv dadhgcdv mardv reldv wicdv borddv
			   mompcraw mompcdv home97 lninc97
				 [pweight=wtx], robust cluster(pcg97id); 
				 
reg lw56 bf1 bf23 bf45 bf6p
 femch black hisp newimmi bapt cath momhgc dadhgc ageb regnc regs regw 
               wic97 marbirth
			   fborn sborn glt35 g3537 le55lb
			   regdv momhgcdv dadhgcdv mardv reldv wicdv borddv
			   mompcraw mompcdv home97 lninc97
				 [pweight=wtx], robust cluster(pcg97id); 
				 
		
clear matrix;
				 
log close;
